﻿<%@ Page Title="Edit Shopping List Details" Language="C#" MasterPageFile="~/Resources/AAMMaster.master"
    AutoEventWireup="true" CodeBehind="editshoppinglist.aspx.cs" Inherits="LMKJ.editshoppinglist" %>

<asp:Content ID="Content" ContentPlaceHolderID="Content" runat="server">
    <div class="form_name">
        Shopping List Management
    </div>
    <table style="width: 100%">
        <tr>
            <td colspan="2">
                <asp:CustomValidator ID="fieldsValidator" runat="server" OnServerValidate="fieldsValidator_ServerValidate"
                    Display="Dynamic" ErrorMessage="Some required fields are empty! All required fields must be completed to edit shopping list!"
                    ForeColor="Red" ValidationGroup="EditShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>List ID </b>
            </td>
            <td>
                <asp:Label ID="lidLbl" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <b>Resident&#39;s NRIC </b>
            </td>
            <td>
                <asp:Label ID="nricLbl" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <b>Appointed Volunteer ID </b>
            </td>
            <td>
                <asp:DropDownList ID="volunteerIdDdl" runat="server"></asp:DropDownList></td>
        </tr>
        <tr>
            <td>
                <b>Date Ordered </b>
            </td>
            <td>
                <asp:Label ID="dateLbl" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                <b>Date Required* </b>
            </td>
            <td>
                <asp:DropDownList ID="monthReqDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="monthReqDdl_SelectedIndexChanged">
                    <asp:ListItem>Month</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="dayReqDdl" runat="server">
                    <asp:ListItem>Day</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="yearReqDdl" runat="server">
                    <asp:ListItem>Year</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:CustomValidator ID="dateReqValidator" runat="server" Display="Dynamic" ErrorMessage="Date must be at least 7 days later than the ordered date!"
                    ForeColor="Red" OnServerValidate="dateReqValidator_ServerValidate" ValidationGroup="EditShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>Date of Purchase </b>
            </td>
            <td>
                <asp:DropDownList ID="monthPurDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="monthPurDdl_SelectedIndexChanged">
                    <asp:ListItem>Month</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="dayPurDdl" runat="server">
                    <asp:ListItem>Day</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="yearPurDdl" runat="server">
                    <asp:ListItem>Year</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:CustomValidator ID="datePurValidator" runat="server" Display="Dynamic" ErrorMessage="Date of purchase cannot be earlier than ordered date!"
                    ForeColor="Red" OnServerValidate="datePurValidator_ServerValidate" ValidationGroup="EditShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>Date of Delivery </b>
            </td>
            <td>
                <asp:DropDownList ID="monthDelDdl" runat="server" AutoPostBack="True" OnSelectedIndexChanged="monthDelDdl_SelectedIndexChanged">
                    <asp:ListItem>Month</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="dayDelDdl" runat="server">
                    <asp:ListItem>Day</asp:ListItem>
                </asp:DropDownList>
                /
                <asp:DropDownList ID="yearDelDdl" runat="server">
                    <asp:ListItem>Year</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <asp:CustomValidator ID="dateDelValidator" runat="server" Display="Dynamic" ErrorMessage="Date of delivery cannot be earlier than ordered date & purchase!"
                    ForeColor="Red" OnServerValidate="dateDelValidator_ServerValidate" ValidationGroup="EditShoppingList"></asp:CustomValidator>
            </td>
        </tr>
        <tr>
            <td>
                <b>Status </b>
            </td>
            <td>
                <asp:RadioButtonList ID="statusRbl" runat="server" RepeatDirection="Horizontal">
                    <asp:ListItem>Pending</asp:ListItem>
                    <asp:ListItem>Completed</asp:ListItem>
                </asp:RadioButtonList>
            </td>
        </tr>
        <tr>
            <td>
                <b>List of Items </b>
            </td>
            <td>
                Item Name:
                <asp:DropDownList ID="existingItemsDdl" runat="server" Width="75%">
                </asp:DropDownList>
                <br />
                Quantity:
                <asp:TextBox ID="quantityTbx" runat="server" Text="0" Width="50px"></asp:TextBox>
                <asp:CustomValidator ID="qtyValidator" runat="server" OnServerValidate="qtyValidator_ServerValidate"
                    Display="Dynamic" ErrorMessage="Please input numbers only!" ForeColor="Red" ValidationGroup="EditShoppingList"></asp:CustomValidator>
                <br />
                <asp:Button ID="addItemToLboxBtn" runat="server" OnClick="addItemToLboxBtn_Click"
                    Text="Add" CssClass="buttonAdd" />
                <asp:Button ID="removeItemFromLboxBtn" runat="server" OnClick="removeItemFromLboxBtn_Click"
                    Text="Remove" CssClass="buttonRemove" />
                <br />
                <asp:ListBox ID="itemsListLbox" runat="server" SelectionMode="Multiple" Width="100%">
                </asp:ListBox>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <b>*Required Fields</b>
            </td>
        </tr>
        <tr>
            <td colspan="2">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Button ID="confirmBtn" runat="server" Text="Confirm Changes" OnClick="confirmBtn_Click"
                    CssClass="buttonConfirmChanges" ValidationGroup="EditShoppingList" />
                <asp:Button ID="cancelBtn" runat="server" Text="Cancel Changes" OnClick="cancelBtn_Click"
                    CssClass="buttonCancelChanges" CausesValidation="False" />
                <asp:Button ID="deleteBtn" runat="server" Text="Delete List" OnClick="deleteBtn_Click"
                    CssClass="buttonDeleteItem" CausesValidation="False" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="confirmationLbl" Text="Are you sure you want to delete this shopping list?<br />Warning: You will not be able to retrieve it back!"
                    runat='server' Visible="False" Font-Bold="True" ForeColor="Red"></asp:Label>
                <br />
                <asp:Button ID="confirmationBtn" Text="Confirm" runat="server" Visible="false" OnClick="confirmationBtn_Click"
                    CssClass="buttonConfirm" />
            </td>
        </tr>
    </table>
</asp:Content>
